package com.open.capacity.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.open.capacity.mapper.BusinessFinanceMapper;
import com.open.capacity.model.BusinessFinance;
import com.open.capacity.model.PageModel;
import com.open.capacity.model.FinanceVO;
import com.open.capacity.service.BusinessFinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessFinanceServiceImpl implements BusinessFinanceService {
    @Autowired
    private BusinessFinanceMapper financeMapper;

    @Override
    public void add(BusinessFinance businessFinance) {
        financeMapper.add(businessFinance);
    }

    @Override
    public void delete(Long id) {
        financeMapper.delete(id);
    }

    @Override
    public List<BusinessFinance> findById(Long id) {
        return financeMapper.findById(id);
    }

    @Override
    public PageInfo<BusinessFinance> findAll(PageModel pageModel,BusinessFinance businessFinance) {
        PageHelper.startPage(pageModel.getPage(), pageModel.getLimit());
        List<BusinessFinance> all = financeMapper.findAll(businessFinance);
         return new PageInfo<>(all);
    }

    @Override
    public List<FinanceVO> daily(Long busiid) {
        return financeMapper.daily(busiid);
    }

    @Override
    public PageInfo<BusinessFinance> dailyList(PageModel pageModel,BusinessFinance businessFinance) {
        PageHelper.startPage(pageModel.getPage(), pageModel.getLimit());
        List<BusinessFinance> all = financeMapper.dailyList(businessFinance);
        return new PageInfo<>(all);
    }

    @Override
    public List<FinanceVO> monthly(Long busiid) {
        return financeMapper.monthly(busiid);
    }

    @Override
    public PageInfo<BusinessFinance> monthlyList(PageModel pageModel,BusinessFinance businessFinance) {
        PageHelper.startPage(pageModel.getPage(), pageModel.getLimit());
        List<BusinessFinance> all = financeMapper.monthlyList(businessFinance);
        return new PageInfo<>(all);
    }
}
